using ThingsEdge.Exchange.Forwarders;

namespace Digitalmes.Infrastructure.Scada.Forwarders;

/// <summary>
/// 通知消息处理。
/// </summary>
internal sealed class NativeNoticeForwarder(IServiceScopeFactory serviceScopeFactory, ILogger<NativeNoticeForwarder> logger) : INoticeForwarder
{
    public Task ReceiveAsync(NoticeContext context, CancellationToken cancellationToken = default)
    {
        logger.LogInformation("通知消息处理，数据：{@Value}", context.Message.Values.Select(s => new { s.Address, s.Value }));

        using var scope = serviceScopeFactory.CreateScope();

        return Task.CompletedTask;
    }
}
